<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <title>添加用户</title>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <script src="js/jquery-3.3.1.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
</head>
<script>
    $(function () {
        $.get("findDep",function (data) {
            var li = '';
            li+='<label for="depId">部门</label>\n' +
                '            <select id="depId" name="depId" class="form-control">\n' +
                '                <option value="-1" selected>请选择</option>';
            for (var i = 0; i <data.length ; i++) {
                lis='<option value="'+data[i].depId+'">'+data[i].depname+'</option>';
                li+=lis;
            }
            li+='</select>';
            $("#depInfo").html(li);
        });

        $("#btn_sub").click(function () {
            $.get("addWay?id=1",$("#addForm").serialize(),function (data) {
                if(data.flag){
                   alert("添加成功！")
                }else{
                    alert(data.errorMsg);
                }
            });
        });
    });


</script>
<body>
<div class="container" style="width: 400px;">
    <h3 style="text-align: center;">考勤设置</h3>
    <form id="addForm" action="" method="post" accept-charset="utf-8">
        <div class="row">
            <div class="form-group " id="depInfo">
                <label for="depId">部门</label>
                <select id="depId" name="depId" class="form-control">
                    <option value="-1" >全部</option>
                    <option value="1" >男</option>
                    <option value="2" >女</option>
                </select>
            </div>
        </div>
        <div class="row">
            <div class="form-group " >
                <label for="week">工作日</label>
                <select id="week" name="week" class="form-control">
                    <option value="-1" selected>请选择</option>
                    <option value="1" >星期一</option>
                    <option value="2" >星期二</option>
                    <option value="3" >星期三</option>
                    <option value="4" >星期四</option>
                    <option value="5" >星期五</option>
                    <option value="6" >星期六</option>
                    <option value="7" >星期日</option>
                </select>
            </div>
        </div>
        <div class="row">
            <div class="form-group">
                <label for="start">上班时间设置</label>
                <input style="margin-top: 8px" type="time" id="start" name="start" >
            </div>
        </div>
        <div class="row">
            <div class="form-group">
                <label for="end">下班时间设置</label>
                <input style="margin-top: 8px" type="time" id="end" name="end" >
            </div>
        </div>
        <hr/>
        <div class="submit_btn" style="text-align: center;">
            <button type="button" class="btn btn-primary" id="btn_sub">提交</button>
        </div>
    </form>

    <!-- 出错显示的信息框 -->
    <div class="alert alert-warning alert-dismissible" role="alert">
        <button type="button" class="close" data-dismiss="alert" >
            <span>&times;</span>
        </button>
        <strong id="errorMsg"></strong>
    </div>
</div>
</body>
</html>